<template>
    <el-menu :default-active="defaultActive" class="el-menu-demo" mode="horizontal" router>
        <el-menu-item :index="item.name" :key="i" v-for="(item,i) in navList">
            {{ item.navItem }}
        </el-menu-item>
        <el-menu-item disabled>消息中心</el-menu-item>
    </el-menu>
</template>

<script>
    export default {
        name: 'NavMenu',
        data() {
            return {
                navList: [
                    {name: '/index', navItem: '首页'},
                    {name: '/furniture', navItem: '家具查询'},
                    {name: '/cms', navItem: '内容管理'}
                ]
            }
        },
        computed: {
            defaultActive() {
                return '/' + this.$route.path.split('/').reverse()[0];
            }
        }
    }
</script>

<style scoped>
</style>
